{% extends "layouts/base.html" %}

{% block title %} Amass Reports {% endblock %} 

<!-- Specific Page CSS goes HERE  -->
{% block stylesheets %}{% endblock stylesheets %}

{% block content %}
        <div class="row">
            <div class="col-md-12">
              <div class="card">
                <div class="card-header card-header-primary">
                  <h4 class="card-title ">Enumeration</h4>
                </div>
                <div class="card-body">
                  <div class="table-responsive">
                    <table class="table">
<tr>
<td>
{% if running %}
Nmap running
{% else %}
Nmap waiting
{% endif %}
</td>
<td>
{% if running %}
<img src="static/assets/asf/wait.gif" width="45" height="50">
{% endif %}
</td>
<td>
<form class="navbar-form" action="vd-in-portscan" method="post">
 			{%csrf_token%}
<span class="bmd-form-group"><div class="input-group no-border">
<!--                 <input type="text" name='target_domain' value="amass enum -df domains.txt" class="form-control" placeholder="New Target exampledomain.com">
 -->                
 {% if running %}
 <input type="hidden" name="nmap_action" value="stop">
                <button type="submit" class="btn btn-white btn-round btn-just-icon"  rel="tooltip" title="" data-original-title="Stop">
                  <i class="material-icons">stop</i>
                  <div class="ripple-container"></div>
                </button>
  {% else %}
 <input type="hidden" name="nmap_action" value="start">
                <button type="submit" class="btn btn-white btn-round btn-just-icon" rel="tooltip" title="" data-original-title="Start">
                  <i class="material-icons">play_arrow</i>
                  <div class="ripple-container"></div>
                </button> 
 {% endif %}
              </div></span>
</form>
</td>
<td>
 <form class="navbar-form" action="vd-export" method="post" style="display: inline;">
 			{%csrf_token%}
             <span class="bmd-form-group"><div class="input-group no-border">
			 <input type="hidden" name="model" value="inservices">
             <button type="submit" class="btn btn-white btn-round btn-just-icon"  rel="tooltip" title="" data-original-title="Export All Objects">
             <i class="material-icons">system_update_alt</i>
             <div class="ripple-container"></div>
             </button>
             </div></span>
</form>
</td><td>
			<span onclick="row = document.getElementById('systemd.timer'); if (row.style.display=='none') {row.style.display='';}else{row.style.display='none';}" style="display: inline;">
			<button type="submit" class="btn btn-white btn-round btn-just-icon" rel="tooltip" title="" data-original-title="Scheduler Service">
			<i class="material-icons">alarm_add</i>
			</button>
			</span>
</td><td>
 <form class="navbar-form" action="vd-export" method="post" style="display: inline;">
 			{%csrf_token%}
             <span class="bmd-form-group"><div class="input-group no-border">
			 <input type="hidden" name="model" value="inservices_cypher">
             <button type="submit" class="btn btn-white btn-round btn-just-icon"  rel="tooltip" title="" data-original-title="Export Cypher">
             <i class="material-icons">device_hub</i>
             <div class="ripple-container"></div>
             </button>
             </div></span>
</form>
</td>
</tr>
                    </table>
<div id="systemd.timer" style="display: none;" align="left">
<h3>Schedule</h3>
    <form class="navbar-form" action="vd-in-portscan" method="post" style="display: inline;">
 			{%csrf_token%}
             <span class="bmd-form-group"><div class="input-group no-border">
			 <input type="hidden" name="nmap_action" value="schedule">
			 <table>
			 <tr>
			 <td colspan="10">
			 {% for day in DaysOfWeek %}
			 <input type="checkbox" name="{{ day }}" {% if day in Days %}checked{% endif %}><label>{{ day }}</label>&nbsp;&nbsp;&nbsp;
			 {% endfor %}
			 <input type="checkbox" name="Disabled" {% if Disabled == 'true' %}checked{% endif %}><label>Disabled</label>&nbsp;&nbsp;&nbsp;
			 </td>
			 </tr>
			 <tr>
			 <td align="right">
			 <h4>Hour:</h4>
			 </td>
			 <td align="left">
			 <select name="hour">
			 {% for i in "x"|rjust:"24" %}
			 <option value="{{ forloop.counter0 }}" {% if forloop.counter0 == Hour %}selected{% endif %}>{{ forloop.counter0 }}</option>
			 {% endfor %}
			 </select>
			 </td>
			 <td align="right">
			 <h4>Minute:</h4>
			 </td>
			 <td align="left">
			 <select name="minute">
			 {% for i in "x"|rjust:"60" %}
			 <option value="{{ forloop.counter0 }}" {% if forloop.counter0 == Minute %}selected{% endif %} >{{ forloop.counter0 }}</option>
			 {% endfor %}
			 </select>
			 </td>
			 <td>
             <button type="submit" class="btn btn-white btn-round btn-just-icon" rel="tooltip" title="" data-original-title="Save schedule">
             <i class="material-icons">save</i>
             <div class="ripple-container"></div>
             </button>
             </td>
             <td></td><td></td><td></td><td></td><td></td>
             </tr>
             </table>
</div>
</span>
</form>
</div>
<!-- Finishes the add on for systemd.timer  -->
                  </div>
                </div>
              </div>
            </div>
</div>
 				<!-- {{ running }} -->
 Try your search
 <table width="100%">
 <tr>
 <td>
 <form class="navbar-form" action="vd-in-portscan" method="post" style="display: inline;">
 			{%csrf_token%}
             <span class="bmd-form-group"><div class="input-group no-border">
             Include: &nbsp;  &nbsp;  &nbsp;<input type="text" name='results_search' value="{{ results_search }}" class="form-control" placeholder="New regex query">
             Exclude:  &nbsp;  &nbsp;  &nbsp;<input type="text" name='results_exclude' value="{{ results_exclude }}" class="form-control" placeholder="Exclude regex query">
			 <input type="hidden" name="nmap_action" value="filter">
             <button type="submit" class="btn btn-white btn-round btn-just-icon" rel="tooltip" title="" data-original-title="Search">
             <i class="material-icons">search</i>
             <div class="ripple-container"></div>
             </button>
             </div></span>
</form>
{% if show_save %}
Save Your Search:
 <form class="navbar-form" action="vd-in-portscan" method="post" style="display: inline;">
 			{%csrf_token%}
             <span class="bmd-form-group"><div class="input-group no-border">
             <input type="hidden" name='regexp_query' value="{{ results_search }}" class="form-control">
             <input type="hidden" name='regexp_exclude' value="{{ results_exclude }}" class="form-control">
             <input type="text" name='regexp_name' value="" class="form-control" placeholder="Title for your RegExp">
             <input type="text" name='regexp_info' value="" class="form-control" placeholder="Description">
			 <input type="hidden" name="nmap_action" value="save_regexp">
             <button type="submit" class="btn btn-white btn-round btn-just-icon" rel="tooltip" title="" data-original-title="Save search">
             <i class="material-icons">save</i>
             <div class="ripple-container"></div>
             </button>
             </div></span>
</form>
{% endif %}
</td>
</tr>
</table>
        <div class="row">
            <div class="col-md-12">
              <div class="card">
                <div class="card-header card-header-primary">
                  <h4 class="card-title ">Filters</h4>
                  <p class="card-category"> Regex queries for Redteam modules</p>
                </div>
                <div class="card-body">
                  <div class="table-responsive">
                    <table class="table">
                      <thead class=" text-primary">
                        <th>
                          Id
                        </th>
                        <th>
                          Name
                        </th>
                        <th>
                          Regular Expression
                        </th>
                        <th style="text-align: center;">
                          Description
                        </th>
                        <th style="text-align: center;">
                          Tools
                        </th>
                      </thead>
                      <tbody>
{% for item in saved_regexp %}
                        <tr>
                          <td>
                             {{ item.id }}
                          </td>
                          <td>
                             {{ item.name }}
                          </td>
                          <td>
                            I:{{ item.regexp }}<br> E:{{ item.exclude }}
                          </td>
                          <td class="text-primary">
                            {{ item.info }}
                          </td>
                          <td style="text-align: center;">
<form class="navbar-form" action="vd-in-portscan" method="post" style="display: inline;">
 			{%csrf_token%}
             <input type="hidden" name='results_search' value="{{ item.regexp }}" class="form-control">
             <input type="hidden" name='results_exclude' value="{{ item.exclude }}" class="form-control">
			 <input type="hidden" name="nmap_action" value="filter">
             <button type="submit" class="btn btn-white btn-round btn-just-icon" rel="tooltip" title="" data-original-title="Search">
             <i class="material-icons">search</i>
             </button>
</form>
<form class="navbar-form" action="vd-in-portscan" method="post" style="display: inline;">
 			{%csrf_token%}
             <input type="hidden" name='regexp_id' value="{{ item.id }}">
			 <input type="hidden" name="nmap_action" value="delete_regexp">
             <button type="submit" class="btn btn-white btn-round btn-just-icon" rel="tooltip" title="" data-original-title="Remove">
             <i class="material-icons">delete</i>
             </button>
</form>
 <form class="navbar-form" action="vd-export" method="post" style="display: inline;">
 			{%csrf_token%}
			 <input type="hidden" name="model" value="services">
			 <input type="hidden" name='regexp_id' value="{{ item.id }}">
             <button type="submit" class="btn btn-white btn-round btn-just-icon"  rel="tooltip" title="" data-original-title="Export search">
             <i class="material-icons">system_update_alt</i>
             <div class="ripple-container"></div>
             </button>
             </div>
</form>
 <form class="navbar-form" action="vd-export" method="post" style="display: inline;">
 			{%csrf_token%}
			 <input type="hidden" name="model" value="inservices_cypher">
			 <input type="hidden" name='regexp_id' value="{{ item.id }}">
             <button type="submit" class="btn btn-white btn-round btn-just-icon"  rel="tooltip" title="" data-original-title="Export in Cypher">
             <i class="material-icons">device_hub</i>
             <div class="ripple-container"></div>
             </button>
             </div>
</form>
                          </td>
                        </tr>

{% endfor %}
                      </tbody>
                    </table>
                  </div>
                </div>
              </div>
            </div>
</div>
<a id="servicelist"></a>
<table width="100%">
<tr>
<td>
 Objects: [{{ query_count }}]
 </td>
<td>
<form class="navbar-form" action="vd-in-portscan#servicelist" method="post" style="display: inline;">
 			{%csrf_token%}
             <span class="bmd-form-group"><div class="input-group no-border">
             <input type="hidden" name='results_search' value="{{ results_search }}">
			 <input type="hidden" name="nmap_action" value="filter">
			 <input type="hidden" name="page" value="{{ query_page_prev }}">
             <button type="submit" class="btn btn-white btn-round btn-just-icon"  rel="tooltip" title="" data-original-title="Previous page">
             <i class="material-icons">skip_previous</i>
             <div class="ripple-container"></div>
             </button>
             </div></span>
</form>
</td>
<td>
 Page [{{ query_page }}]
</td>
<td>
<form class="navbar-form" action="vd-in-portscan#servicelist" method="post" style="display: inline;">
 			{%csrf_token%}
             <span class="bmd-form-group"><div class="input-group no-border">
             <input type="hidden" name='results_search' value="{{ results_search }}">
			 <input type="hidden" name="nmap_action" value="filter">
			 <input type="hidden" name="page" value="{{ query_page_next }}">
             <button type="submit" class="btn btn-white btn-round btn-just-icon" rel="tooltip" title="" data-original-title="Next page">
             <i class="material-icons">skip_next</i>
             <div class="ripple-container"></div>
             </button>
             </div></span>
</form>
</td>
</tr>
</table>
        <div class="row">
            <div class="col-md-12">
              <div class="card">
                <div class="card-header card-header-primary">
                  <h4 class="card-title ">Ports and services</h4>
                </div>
                <div class="card-body">
                  <div class="table-responsive">
                    <table class="table">
                      <thead class=" text-primary">
                        <th>
                          Id
                        </th>
                        <th>
                        Screenshot
                        </th>
                        <th>
                          Host
                        </th>
                        <th>
                          Last Report
                        </th>
                        <th style="text-align: center;">
                          Services
                        </th>
                        <th style="text-align: center;">
                          Owner
                        </th>
                        <th>
                          Tag
                        </th>
                        <th style="text-align: center;">
                          Tools
                        </th>
                      </thead>
                      <tbody>
{% for item in query_results %}
                        <tr>
                          <td>
                            {{ item.id }}
                          </td>
                          <td>
                          <span onclick="row = document.getElementById('host_picture_{{ item.id }}'); if (row.style.display=='none') {row.style.display='';}else{row.style.display='none';}">
                          <img src="{{ item.screenshot }}" height="60">
                          </span>
                          </td>
                          <td>
                            {{ item.name }}<br>
                            {{ item.nname }}<br>
                            {{ item.ipv4 }}
                          </td>
                          <td>
                            {{ item.lastdate }}
                          </td>
                          <td class="text-primary">
                            {{ item.ports }}
                          </td>
                          <td class="text-primary">
                          <span onclick="row = document.getElementById('metadata-{{ item.id }}'); if (row.style.display=='none') {row.style.display='';}else{row.style.display='none';}" style="display: inline;">
                            {{ item.owner }}
                          </span>
                          </td>
                           <td>
                            {{ item.tag }}
                          </td>                          
                          <td style="text-align: center;">
							<span onclick="row = document.getElementById('host_{{ item.id }}'); if (row.style.display=='none') {row.style.display='';}else{row.style.display='none';}" style="display: inline;">
							<button type="submit" class="btn btn-white btn-round btn-just-icon" rel="tooltip" title="" data-original-title="Show Reports">
							<i class="material-icons">assignment</i>
							</button>
							</span>
							 <form class="navbar-form" action="vd-in-portscan" method="post" style="display: inline;">
							 			{%csrf_token%}
							             <span class="bmd-form-group"><div class="input-group no-border">
										 <input type="hidden" name="nmap_action" value="delete">
										 <input type="hidden" name="id" value="{{ item.id }}">
							             <button type="submit" class="btn btn-white btn-round btn-just-icon" rel="tooltip" title="" data-original-title="Delete Results and Hosts">
							             <i class="material-icons">delete</i>
							             <div class="ripple-container"></div>
							             </button>
							             </div></span>
							</form>
                          </td>
                        </tr>
<tr id='host_{{ item.id }}' style="display: none;">
<td>.</td>
<td colspan="4">
<pre style="white-space: pre-wrap;">
{{ item.info }}
</pre>
</td>
</tr>
<tr id='host_picture_{{ item.id }}' style="display: none;">
<td>.</td>
<td colspan="4">
<img src="{{ item.screenshot }}" width="100%">
</td>
</tr>
 <tr>
 <td colspan=10 id="metadata-{{ item.id }}" style="display: none;">
 {{ item.metadata }}
 </td>
 </tr>

{% endfor %}
                      </tbody>
                    </table>
                  </div>
                </div>
              </div>
            </div>
</div>
{% endblock content %}

<!-- Specific Page JS goes HERE  -->
{% block javascripts %}{% endblock javascripts %}
